@extends('admin.layout')
@section('title','首页')
@section('content1')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
        <div class="col-md-12" id="content" >
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>专家列表</h3>
            </div>
            <div style="float:right;"><button type="button" class="btn btn-primary" onclick="window.location.href='/adm/expert/add'">新增专家</button></div>
            <form action="/adm/expert/del-expert" method="post">
            <table class="table table-striped">
                @csrf
                <thead>
                <tr>
                    <th>id</th>
                    <th>姓名</th>
                    <th>职称</th>
                    <th>科室</th>
                    <th>医院</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($oExperts as $v)
                <tr>
                    <th scope="row">{{$v->id}}</th>
                    <td>{{$v->name}}</td>
                    <td>{{$v->chenghao}}</td>
                    <td>{{$v->department}}</td>
                    <td>{{$v->hospital}}</td>
                    <td>
                        <a href="/adm/expert/edit/{{$v->id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
                        &nbsp;&nbsp;&nbsp;
                        <a onclick="delExpert({{$v->id}})"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
                {{$oExperts->links('admin.page')}}
            </form>
            <script>
                function delExpert(id){
                    if(confirm('确定要删除该专家吗？')){
                        var url="/adm/expert/del-expert";
                        var token="{{@csrf_token()}}";
                        $.post(url,{'_token':token,'id':id},function(data){
                            alert('已删除');
                            location.reload();
                        });
                    }
                }
            </script>



        </div>
    </div>

@endsection
